package com.lu.controller;

import com.lu.pojo.Friends;
import com.lu.pojo.User;
import com.lu.service.FriendsService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class FriendsController {
    @Resource
    private FriendsService friendsService;
    @GetMapping("/getFriend/{friendid}/{fuserid}")
    public List<Friends> getFriend(@PathVariable("friendid") int friendid,@PathVariable("fuserid") int fuserid){
        return friendsService.getFriend(friendid,fuserid);
    }
    @GetMapping("/addFriend/{friendid}/{fuserid}")
    public int addFriend(@PathVariable("friendid") int friendid,@PathVariable("fuserid") int fuserid){
        return friendsService.addFriend(friendid,fuserid,null);
    }

    @GetMapping("/getFriends/{fuserid}")
    public List<User> getFriends(@PathVariable("fuserid") int fuserid){
        return friendsService.getFriends(fuserid);
    }
    @GetMapping("/DeleteFriend/{fuserid}/{friendid}")
    public int DeleteFriend(@PathVariable("fuserid") int fuserid,@PathVariable("friendid") int friendid){
        return friendsService.DeleteFriend(fuserid,friendid);
    }
}
